# STAT 202 Homework 1 Part 2
# 
# Author: Fatih Sunor
###############################################################################

# Set working directory
setwd("C:/R/STAT202");

# Read data
data <- read.csv("myfirstdata.csv",header=FALSE);

# R recognizes categorical (factor) and quantitative (numeric) data
# You can kindly ask R as below
# Data type numeric vs factor
is.numeric(data[,1]); # [1] TRUE
is.numeric(data[,2]); # [1] TRUE
is.factor(data[,1]); # [1] FALSE
is.factor(data[,2]); # [1] FALSE

# First column is a discrete data set, you can visually identify data levels.
# Data looks denser around 0, 1 and 2 levels, there is a general diminishing 
# data density as the value increases.
plot(data[,1]);

# Second column is a discrete data set as well, except has an outlier, 51,
# which seems to violate the general diminishing data density as the value increases.
plot(data[,2]);

# Statistics
mean(data[,1]); # [1] 1.593
max(data[,1]); # [1] 27
var(data[,1]); # [1] 4.526614
quantile(data[,1],.25); # 25% 0